package test;

/**
 * @Author: yuanZhi...
 * @Date: created in  2021/12/19 17:15
 */
public class DeliverCandy {
    public static void main(String[] args) {
        int sum = 9;
        int times = 0;
        while (sum > 1) {
            if (sum % 2 != 0) {
                // 判断是加一还是减一
                if (((sum + 1) / 2) % 2 == 0) {
                    sum++;
                } else {
                    sum--;
                }
                times++;
            }
            sum /= 2;
            times++;
        }
        System.out.println(times);
    }
}
